package com.example.rbac.controller.view;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Base64;

@Controller
@RequestMapping("table")
public class TableController {

    @GetMapping("tableListView")
    public String tableListView(){
        Base64.Encoder encoder = Base64.getEncoder();
        String str = "Hello, world!";
        byte[] bytes = encoder.encode(str.getBytes());
        str = new String(bytes);
        return "/table/table-list";
    }

    @GetMapping("tableFieldListView")
    public String tableFieldListView(String tableName, Model model){
        model.addAttribute("tableName", tableName);
        return "/table/tableField-list";
    }
}
